import http from "@/utils/request";

const apiPrefix = "/admin";


export async function addAdmin(data) {
    return await http.request({
        data: data,
        url: apiPrefix,
        method: 'post'
    })
}

export async function deleteAdminById(id){
    return await http.request({
        params: {
            id
        },
        url: apiPrefix+'/id',
        method: 'delete'
    })
}

export async function deleteAdminByIds(ids){
    return await http.request({
        params: {
            ids
        },
        url: apiPrefix+'/batch',
        method: 'delete'
    })
}


export async function searchAdminById(id){
    return await http.request({
        params: {
            id
        },
        url: apiPrefix+'/id',
        method: 'get'
    })
}

export async function searchAdmin(params){
    return await http.request({
        params: params,
        url: apiPrefix,
        method: 'get'
    })
}

export async function searchAdminByPage(params){
    return await http.request({
        params: params,
        url: apiPrefix+'/page',
        method: 'get'
    })
}


export async function updateAdminById(data){
    return await http.request({
        data: data,
        url: apiPrefix,
        method: 'put'
    })
}
